<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 对象语法 -->
        <h2 :class="{active:isActive,line:isLine}">{{msg}}</h2>
        <h2 :class="act()">{{msg}}</h2>
        <button @click="btn">按钮</button>
        <!-- 数组语法 -->
        <h2 :class="['active','line','title']">{{msg}}</h2>
        <h2 :class="['active','line',title]">{{msg}}</h2>
    </div>
</body>
<script src='../js/vue.js'></script>
<script>
    let app = new Vue({
        el: '#app',
        data: {
             msg:'hello vue.js',
             isActive:true,
             isLine:false,
             title:'aaaaaa'
        },
        methods: {
            btn(){
                this.isActive=!this.isActive
            },
            act(){
                return {active:this.isActive,line:this.isLine}
            }
        }
    })
</script>
</html>